package it.kion.util.ui.ulog2;

import java.util.HashSet;

import org.apache.log4j.spi.LoggingEvent;

public class FilterSet extends HashSet<Filter> {

	private static final long serialVersionUID = 1636273735331707319L;

	public FilterSet() {
		super();
	}

	public void addFilter(Filter filter) {
		add(filter);
	}

	public void removeFilter(Filter filter) {
		remove(filter);
	}

	public Filter[] getFilters() {
		return toArray(new Filter[0]);
	}

	public boolean isValidForShow(LoggingEvent le) {
		for (Filter filter : this) {
			if (!filter.isValid(le)){
				return false;
			}
		}
		return getQuickFilter() == null || getQuickFilter().isValid(le, true);
	}

	public int getCount() {
		return size();
	}

	public Filter getQuickFilter() {
		return quickFilter;
	}

	public void setQuickFilter(Filter aFilter) {
		quickFilter = aFilter;
	}

	private Filter quickFilter;
	
}
